package model;

import connection.DbConnection;
import bean.PollUser;
import java.sql.*;
import java.util.ArrayList;

public class AddMasterImpl {
	
	
	/**
	 * Sets all PollUser javabean attributes from database (even if empty in database).
	 * 
	 * @param user is PollUser bean
	 */

		
			private static PreparedStatement st;
			private static Connection conn;
			private static ResultSet rs;
				
			public void addmaster(PollUser user){
				
				
				try{
					rs = null;
					conn = new DbConnection().getConn();
					
					System.out.println("*****//RESULTSET NEXT");
					st = conn.prepareStatement("insert into PollUser (username, password, email, accessibility, fname, lname) values (?,?,?,?,?,?)");
					
					st.setString(1, user.getUsername());
					st.setString(2, user.getPassword());
					st.setString(3, user.getEmail());
					st.setInt(4, 2);
					st.setString(5, user.getFirstname());
					st.setString(6, user.getLastname());
					rs=st.executeQuery();	
					
			    	
			    	
					
				}catch(Exception e){
					e.printStackTrace();
				}
			}
		}